package honor.exam;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * @author : Rookie
 * @description : 报文中出现A->12 34 B->AB CD
 * @date : 2023/8/25
 */
public class BwZy {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] split = s.split(" ");
        List<String> result = new ArrayList<>(split.length);
        for (int i =1;i<split.length;i++) {
            String input = split[i];
            if (input.equals("A")) {
                result.add("12");
                result.add("34");
            } else if (input.equals("B")) {
                result.add("AB");
                result.add("CD");
            } else {
                result.add(input);
            }
        }
        result.add(0,String.valueOf(result.size() + 1));
        String res = String.join(" ", result);
        System.out.println(res);
    }
}
